import java.awt.*;
import java.awt.image.BufferedImage;
import javax.swing.*;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;

import javax.imageio.ImageIO;

import create_album.RechercheFichier;

public class ListView {

    public static void main(String[] args) throws IOException {
    	RechercheFichier file = new RechercheFichier();
		file.RechercheFichierFileOrDirectory();
		ArrayList<String> toto = file.getFileList();
        JFrame frame=new JFrame();
		frame.setTitle("Album View");
		frame.setBackground(Color.GRAY);
        frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        DefaultListModel listModel = new DefaultListModel();
        int count = 0;
        for (int i = 0; i < toto.size(); i++)
        {
        	Image img = ImageIO.read(new File(toto.get(i)));
			//redimensionner les images
			Image scaleImg = img.getScaledInstance(150, -1, Image.SCALE_FAST);
			ImageIcon ii = new ImageIcon(scaleImg);
//        	  ImageIcon ii = new ImageIcon(ImageIO.read(new File(toto.get(i))));
                listModel.add(count++, ii);
        }
        JList lsm=new JList(listModel);
        lsm.setLayoutOrientation(JList.VERTICAL_WRAP);
        lsm.setVisibleRowCount(1);
        
        frame.add(new JScrollPane(lsm));

        frame.pack();
        frame.setVisible(true);
    }
}